package com.yyfax.common.form;

import android.content.Context;
import android.text.TextUtils;

import com.yyfax.common.R;
import com.yyfax.common.toast.CompatToast;
import com.yyfax.common.tools.IDCardValidate;
import com.yyfax.common.tools.Toaster;

/**
 * Created by fuqiang on 2017/5/4.
 * 身份证校验
 * Copyright  2017 www.yylending.com. All Rights Reserved.
 */
public class IdCardValidate {
    public static boolean validate(Context context, FormInputView formInputView, NoticeText noticeText) {
        if (TextUtils.isEmpty(formInputView.getFormText())) {
			CompatToast.showShortToast(context.getApplicationContext(), noticeText.mEmptyMsg);
            return false;
        } else {
            String msg = IDCardValidate.checkIdCard(formInputView.getFormText(), formInputView.ismCheckAge(), context.getString(R.string.error_age_strs));
            if (!TextUtils.isEmpty(msg)) {
				CompatToast.showShortToast(context.getApplicationContext(), msg);
                return false;
            }
        }
        return true;
    }
}
